/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.seari.cctv.handler;

import com.seari.cctv.ParseXmlToString;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 *
 * @author 29120
 */
public class CctvEncoder extends MessageToByteEncoder {


    @Override
    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
        
        ParseXmlToString psx = new ParseXmlToString();
        String str = psx.thansferToXml(msg);
        byte[] bytes = str.getBytes();
        out.writeBytes(bytes);
    }
}
